package IO;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-11-27
 * Time: 17:28
 */
public class Demo5 {
    public static void main(String[] args) throws IOException {
        File file = new File("./test.txt");
//        File file1 = new File("./test.txt");
//        System.out.println("file是否存在: " + file.exists());
//        System.out.println("file1是否存在: " + file1.exists());
//        System.out.println("renameTo执行是否成功: "+file.renameTo(file1));
//        System.out.println("file是否存在: " + file.exists());
//        System.out.println("file1是否存在: " + file1.exists());
        File file1 = new File("./src/test2.txt");

        System.out.println("file是否存在: " + file.exists());
        System.out.println("file1是否存在: " + file1.exists());

        System.out.println("file的路径" + file.getCanonicalPath());

        System.out.println("renameTo执行是否成功: "+file.renameTo(file1));

        System.out.println("file是否存在: " + file.exists());
        System.out.println("file1是否存在: " + file1.exists());

        System.out.println("file1的路径" + file1.getCanonicalPath());

    }
}
